package org.demo.szml.userservice.controller.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Collections;
import java.util.List;

/**
 * @description: 数据库分页视图类
 * @date: 2025/6/17 23:13
 * @version: 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageVO<E> {
    private List<E> list;
    private Long total;

    // 静态方法来创建 PageVO 实例
    public static <T> PageVO<T> of(List<T> list, long total) {
        return new PageVO<>(list, total);
    }

    public static <T> PageVO<T> empty() {
        return new PageVO<>(Collections.emptyList(), 0L);
    }

}

